<?php
	class Model_guide extends CI_Model{
		protected $_table = "tbl_guides";
		public function __construct(){
			parent::__construct();
			$this->load->database();
		}
		public function news(){
			$this->db->order_by("guide_id","DESC");
			$this->db->limit(6);
			return $this->db->get($this->_table)->result_array();
		}
		public function listnews($id1,$id2){
			$this->db->where("cate_id",$id1);
			$this->db->where("guide_id !=",$id2);
			$this->db->limit(5);
			return $this->db->get($this->_table)->result_array();
		}
		public function getnews($id,$off,$start){
			$this->db->where("cate_id",$id);
			$this->db->limit($off,$start);
			return $this->db->get($this->_table)->result_array();
		}
		public function count_all(){
			return $this->db->count_all($this->_table);
		}
		public function list_all($off,$start){
			$this->db->limit($off,$start);
			return $this->db->get($this->_table)->result_array();
		}
		public function detail($id){
			$this->db->where("guide_id",$id);
			return $this->db->get($this->_table)->row_array();
		}
        public function getonenew() {
            $this->db->limit(1)
                ->order_by('guide_id', 'desc');
            return $this->db->get($this->_table)->row_array();
        }
        public function listAther($id,$off=null,$start=null){
            return $this->db
                ->where('guide_id !=', $id)
                ->order_by('guide_id', 'desc')
                ->limit($off,$start)
                ->get($this->_table)
                ->result_array();
        }
	}